nethackfandomcom-20200214-history
Source:SLASH'EM 0.0.7E7F2/monst.h
Below is the full text to monst.h from the source code of SLASH'EM 0.0.7E7F2. To link to a particular line, write [[SLASH'EM 0.0.7E7F2/monst.h#line123]], for example. The latest source code for vanilla NetHack is at Source code. 1. /* SCCS Id: @(#)monst.h 3.4 1999/01/04 */ 2. /* Copyright © Stichting Mathematisch Centrum, Amsterdam, 1985. */ 3. /* NetHack may be freely redistributed. See license for details. */ 4. 5. #ifndef MONST_H 6. #define MONST_H 7. 8. /* The weapon_check flag is used two ways: 9. * 1) When calling mon_wield_item, is 2-6 depending on what is desired. 10. * 2) Between calls to mon_wield_item, is 0 or 1 depending on whether or not 11. * the weapon is known by the monster to be cursed (so it shouldn't bother 12. * trying for another weapon). 13. * I originally planned to also use 0 if the monster already had its best 14. * weapon, to avoid the overhead of a call to mon_wield_item, but it turns out 15. * that there are enough situations which might make a monster change its 16. * weapon that this is impractical. --KAA 17. */ 18. # define NO_WEAPON_WANTED 0 19. # define NEED_WEAPON 1 20. # define NEED_RANGED_WEAPON 2 21. # define NEED_HTH_WEAPON 3 22. # define NEED_PICK_AXE 4 23. # define NEED_AXE 5 24. # define NEED_PICK_OR_AXE 6 25. 26. /* The following flags are used for the second argument to display_minventory 27. * in invent.c: 28. * 29. * MINV_NOLET If set, don't display inventory letters on monster's inventory. 30. * MINV_ALL If set, display all items in monster's inventory, otherwise 31. * just display wielded weapons and worn items. 32. */ 33. #define MINV_NOLET 0x01 34. #define MINV_ALL 0x02 35. 36. #ifndef ALIGN_H 37. #include "align.h" 38. #endif 39. 40. struct monst { 41. struct monst *nmon; 42. struct permonst *data; 43. unsigned m_id; 44. short mnum; /* permanent monster index number */ 45. short movement; /* movement points (derived from permonst definition and added effects */ 46. uchar m_lev; /* adjusted difficulty level of monster */ 47. aligntyp malign; /* alignment of this monster, relative to the 48. player (positive = good to kill) */ 49. xchar mx, my; 50. xchar mux, muy; /* where the monster thinks you are */ 51. #define MTSZ 4 52. coord mtrackMTSZ; /* monster track */ 53. int mhp, mhpmax; 54. int m_en, m_enmax; /* Power level (for spells, etc.) */ 55. unsigned mappearance; /* for undetected mimics and the wiz */ 56. uchar m_ap_type; /* what mappearance is describing: */ 57. #define M_AP_NOTHING 0 /* mappearance is unused -- monster appears 58. as itself */ 59. #define M_AP_FURNITURE 1 /* stairs, a door, an altar, etc. */ 60. #define M_AP_OBJECT 2 /* an object */ 61. #define M_AP_MONSTER 3 /* a monster */ 62. 63. schar mtame; /* level of tameness, implies peaceful */ 64. unsigned long mintrinsics; /* initialized from mresists */ 65. int mspec_used; /* monster's special ability attack timeout */ 66. int oldmonnm; /* Old monster number - for polymorph */ 67. 68. Bitfield(female,1); /* is female */ 69. Bitfield(minvis,1); /* currently invisible */ 70. Bitfield(invis_blkd,1); /* invisibility blocked */ 71. Bitfield(perminvis,1); /* intrinsic minvis value */ 72. Bitfield(cham,3); /* shape-changer */ 73. /* note: lychanthropes are handled elsewhere */ 74. #define CHAM_ORDINARY 0 /* not a shapechanger */ 75. #define CHAM_CHAMELEON 1 /* animal */ 76. #define CHAM_DOPPELGANGER 2 /* demi-human */ 77. #define CHAM_SANDESTIN 3 /* demon */ 78. #define CHAM_MAX_INDX CHAM_SANDESTIN 79. Bitfield(mundetected,1); /* not seen in present hiding place */ 80. /* implies one of M1_CONCEAL or M1_HIDE, 81. * but not mimic (that is, snake, spider, 82. * trapper, piercer, eel) 83. */ 84. 85. Bitfield(mcan,1); /* has been cancelled */ 86. Bitfield(mburied,1); /* has been buried */ 87. Bitfield(mspeed,2); /* current speed */ 88. Bitfield(permspeed,2); /* intrinsic mspeed value */ 89. Bitfield(mrevived,1); /* has been revived from the dead */ 90. Bitfield(mavenge,1); /* did something to deserve retaliation */ 91. 92. Bitfield(mflee,1); /* fleeing */ 93. Bitfield(mfleetim,7); /* timeout for mflee */ 94. 95. Bitfield(mcansee,1); /* cansee 1, temp.blinded 0, blind 0 */ 96. Bitfield(mblinded,7); /* cansee 0, temp.blinded n, blind 0 */ 97. 98. Bitfield(mcanmove,1); /* paralysis, similar to mblinded */ 99. Bitfield(mfrozen,7); 100. 101. Bitfield(msleeping,1); /* asleep until woken */ 102. Bitfield(mstun,1); /* stunned (off balance) */ 103. Bitfield(mconf,1); /* confused */ 104. Bitfield(mpeaceful,1); /* does not attack unprovoked */ 105. Bitfield(mtrapped,1); /* trapped in a pit, web or bear trap */ 106. Bitfield(mleashed,1); /* monster is on a leash */ 107. Bitfield(isspell,1); /* is a temporary spell being */ 108. Bitfield(uexp,1); /* you get experience for its kills */ 109. 110. Bitfield(mtraitor,1); /* Former pet that turned traitor */ 111. Bitfield(isshk,1); /* is shopkeeper */ 112. Bitfield(isminion,1); /* is a minion */ 113. Bitfield(isgd,1); /* is guard */ 114. Bitfield(isgyp, 1); /* is a gypsy */ 115. Bitfield(ispriest,1); /* is a priest */ 116. Bitfield(iswiz,1); /* is the Wizard of Yendor */ 117. Bitfield(wormno,5); /* at most 31 worms on any level */ 118. #define MAX_NUM_WORMS 32 /* should be 2^(wormno bitfield size) */ 119. 120. long mstrategy; /* for monsters with mflag3: current strategy */ 121. #define STRAT_ARRIVE 0x40000000L /* just arrived on current level */ 122. #define STRAT_WAITFORU 0x20000000L 123. #define STRAT_CLOSE 0x10000000L 124. #define STRAT_WAITMASK 0x30000000L 125. #define STRAT_HEAL 0x08000000L 126. #define STRAT_GROUND 0x04000000L 127. #define STRAT_MONSTR 0x02000000L 128. #define STRAT_PLAYER 0x01000000L 129. #define STRAT_NONE 0x00000000L 130. #define STRAT_STRATMASK 0x0f000000L 131. #define STRAT_XMASK 0x00ff0000L 132. #define STRAT_YMASK 0x0000ff00L 133. #define STRAT_GOAL 0x000000ffL 134. #define STRAT_GOALX(s) ((xchar)((s & STRAT_XMASK) >> 16)) 135. #define STRAT_GOALY(s) ((xchar)((s & STRAT_YMASK) >> 8)) 136. 137. long mtrapseen; /* bitmap of traps we've been trapped in */ 138. long mlstmv; /* for catching up with lost time */ 139. #ifndef GOLDOBJ 140. long mgold; 141. #endif 142. struct obj *minvent; 143. 144. struct obj *mw; 145. long misc_worn_check; 146. xchar weapon_check; 147. 148. /* 149. * NOTE: DO NOT ADD PARTS TO MONST STRUCT AFTER THIS POINT! 150. * ALL ADDITIONS SHOULD GO BEFORE!! 151. * --WAC 152. */ 153. uchar mnamelth; /* length of name (following mxlth) */ 154. short mxlth; /* length of following data */ 155. /* in order to prevent alignment problems mextra should 156. be (or follow) a long int */ 157. int meating; /* monster is eating timeout */ 158. long mextra1; /* monster dependent info */ 159. }; 160. 161. /* 162. * Note that mextra[] may correspond to any of a number of structures, which 163. * are indicated by some of the other fields. 164. * isgd -> struct egd 165. * ispriest -> struct epri 166. * isshk -> struct eshk 167. * isminion -> struct emin 168. * (struct epri for roaming priests and angels, which is 169. * compatible with emin for polymorph purposes) 170. * mtame -> struct edog 171. * (struct epri for guardian angels, which do not eat 172. * or do other doggy things) 173. * Since at most one structure can be indicated in this manner, it is not 174. * possible to tame any creatures using the other structures (the only 175. * exception being the guardian angels which are tame on creation). 176. */ 177. 178. #define newmonst(xl) (struct monst *)alloc((unsigned)(xl) + sizeof(struct monst)) 179. #define dealloc_monst(mon) free((genericptr_t)(mon)) 180. 181. /* these are in mspeed */ 182. #define MSLOW 1 /* slow monster */ 183. #define MFAST 2 /* speeded monster */ 184. 185. #define NAME(mtmp) (((char *)(mtmp)->mextra) + (mtmp)->mxlth) 186. 187. #define MON_WEP(mon) ((mon)->mw) 188. #define MON_NOWEP(mon) ((mon)->mw = (struct obj *)0) 189. 190. #define DEADMONSTER(mon) ((mon)->mhp < 1) 191. 192. #endif /* MONST_H */ monst.h